﻿<!DOCTYPE html
  PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
  <meta http-equiv="X-UA-Compatible" content="IE=EDGE;IE=11;IE=8,chrome=1" />
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>生产报工</title>
  <link href="/InSiteWebApplication/Content/Easyui/themes/metro/easyui.css" rel="stylesheet" />
  <link href="/InSiteWebApplication/Content/Easyui/custom-easyui.css" rel="stylesheet" />
  <link href="/InSiteWebApplication/Content/Easyui/themes/icon.css" rel="stylesheet" />
  <link rel="stylesheet" href="/InSiteWebApplication/Content/webuploader/webuploader.css" />
  <style>
    .easyui-linkbutton {
      margin-left: 20px;
    }

    table tr td {
      padding: 0px 5px;
    }

    #ApsPoolForm {
      padding: 10px 0px;
    }

    .priority {
      margin: 0 10px;
    }

    .fontRight {
      text-align: right;
      padding: 5px 0;
      display: grid;
    }

    .btnlinkbutton .easyui-linkbutton {
      width: 100px;
    }
  </style>
</head>

<body>
  <div class="panelSection">
    <div class="easyui-panel " title="查询区域" style="padding: 3px;width:100%"
      data-options="closable:false,collapsible:true,minimizable:false,maximizable:false">
      <form id="searchForm" method="post">
        <table>
          <tr class="divLabel">
            <td>扫描任务单</td>
            <td>发动机号(起)</td>
            <td>发动机号(止)</td>
            <td>计划开始日期</td>
            <td>计划结束日期</td>
            <td></td>
            <td></td>
            <td style="color: #ddd">工时分值</td>
            <td style="color: #ddd">总工时</td>
            <td style="color: #ddd">总绩效</td>
            <td rowspan="2">
              <a href="javascript:void(0)" class="easyui-linkbutton" onclick="page.addContainerStepWorkReportInfo()"
                style="width: 60px; height: 50px;">报工</a>
            </td>
            <td rowspan="2">
              <a href="javascript:void(0)" class="easyui-linkbutton" onclick="page.createMesFeedBack()"
                style="width: 80px; height: 50px;">问题快反</a>
            </td>
          </tr>
          <tr>
            <td>
              <input id="Text12" name="ContainerNo" class="easyui-textbox" style="width: 150px;height: 22px" />
            </td>
            <td>
              <input id="Text13" name="MachineStart" class="easyui-textbox" style="width: 150px;height: 22px" />
            </td>
            <td>
              <input id="Text14" name="MachineEnd" class="easyui-textbox" style="width: 150px;height: 22px" />
            </td>
            <td>
              <input id="Text15" name="BeginDate" class="easyui-datebox" style="width: 150px; height: 22px" />
            </td>
            <td>
              <input id="Text16" name="EndDate" class="easyui-datebox" style="width: 150px; height: 22px" />
            </td>
            <td>
              <a href="javascript:void(0)" class="easyui-linkbutton" onclick="page.searchData()">查询</a>
            </td>
            <td>
              <a href="javascript:void(0)" class="easyui-linkbutton" onclick="page.searchReset()">重置</a>
            </td>
            <td>
              <input id="txtTimeAttribute" name="txtTimeAttribute" class="easyui-textbox"
                style="width: 80px;height: 22px" disabled="disabled" />
            </td>
            <td>
              <input id="txtSumWorkTime" name="txtSumWorkTime" class="easyui-textbox" style="width: 80px;height: 22px"
                disabled="disabled" />
            </td>
            <td>
              <input id="txtSumJX" name="txtSumJX" class="easyui-textbox" style="width: 80px; height: 22px"
                disabled="disabled" />
            </td>
          </tr>
        </table>
      </form>
    </div>
  </div>
  <div class="panelSection">
    <div class="easyui-panel " title="任务单信息" style="padding: 3px;width:100%"
      data-options="closable:false,collapsible:true,minimizable:false,maximizable:false">
      <table id="WorkReporTable" style="height: 240px" data-options="rownumbers:true">
      </table>
    </div>
  </div>
  <div class="panelSection">
    <div class="easyui-panel " title="工序工步信息" style="padding: 3px;width:100%"
      data-options="closable:false,collapsible:true,minimizable:false,maximizable:false">
      <div class="easyui-layout" style="height: 400px;width:100%">
        <div data-options="region:'west'" title="" style="width: 55%;">
          <table id="wgWorkflowsteps" style="height: 340px;width:100%" data-options="rownumbers:true">
          </table>
          <table>
            <tr>
              <td>
                日结工序问题记录
              </td>
              <td rowspan="2">
                <input class="easyui-textbox" id="DailySettlementSpecProblemRecord" style="height: 50px;
                                    width: 400px;" data-options="multiline:true" />
              </td>
              <td>
                <a href="javascript:void(0)" class="easyui-linkbutton"
                  onclick="page.saveDailySettlementSpecProblemRecord()">
                  保存</a>
              </td>
            </tr>
          </table>
        </div>
        <div data-options="region:'center',title:''">
          <table id="wgStepInfo" style="height: 340px" data-options="rownumbers:true">
          </table>
          <table>
            <tr>
              <td>
                超期报工原因类型
              </td>
              <td rowspan="2">
                <input class="easyui-textbox" id="txtReason" style="height: 50px; width: 400px;"
                  data-options="multiline:true,prompt:'超期报工原因'" />
              </td>
            </tr>
            <tr>
              <td>
                <input class="easyui-combobox" id="ddlReasonType" style="width: 150px; height: 22px" />
              </td>
            </tr>
          </table>
        </div>
      </div>
    </div>
    <div style="height: 40px; line-height: 40px" class="btnlinkbutton">
      <a href="javascript:void(0)" class="easyui-linkbutton" onclick="page.lookProgress()">
        查看准备进度</a> <a href="javascript:void(0)" class="easyui-linkbutton" onclick="page.puplViewDocument()">
        查看工艺</a> <a href="javascript:void(0)" class="easyui-linkbutton" onclick="page.receiveDispatch()">
        任务接收</a> <a href="javascript:void(0)" class="easyui-linkbutton" onclick="page.sendDeliveryApply()">
        发送配送提请</a> <a href="javascript:void(0)" class="easyui-linkbutton" onclick="page.reciveMaterialConfirm()">
        收料确认</a> <a href="javascript:void(0)" class="easyui-linkbutton" onclick="page.containerWorkflowstepOpenWork()">
        开工</a> <a href="javascript:void(0)" class="easyui-linkbutton" onclick="page.puplIssueOperate()">
        装配操作</a> <a href="javascript:void(0)" class="easyui-linkbutton" onclick="page.pupSplitOperate()">
        分解操作</a> <a href="javascript:void(0)" class="easyui-linkbutton" onclick="page.pupInputChechPoint()">
        实测值录入</a> <a href="javascript:void(0)" class="easyui-linkbutton" onclick="page.pupQualityCheck()">
        质量问题查看</a> <a href="javascript:void(0)" class="easyui-linkbutton" onclick="page.PupPartRecept()">
        零组件交换</a>
    </div>
  </div>
  <!--信息提示区域-->
  <div id="statusMessage" style="font-size: 14px; height: 40px">
  </div>
  <div id="win">
  </div>
</body>

</html>
<script src="/InSiteWebApplication/Scripts/json2.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Content/Easyui/jquery.min.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Content/Easyui/jquery.easyui.min.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Content/Easyui/easyui-lang-zh_CN.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Scripts/array.pollyfill.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Scripts/CustomPageJs/CustomCommon.js" type="text/javascript"></script>
<script>
  //创建人：longb
  //日期：2023-03-22
  //描述：装试生产报工
    var page = {
        rootPath: getRootPath(), //网站根路径
        ajaxUrl: getRootPath() + "/Ashx/ZsHandler/ZSContainerStepWorkReportHandler.ashx",
        init: function () {
            page.bind();
            page.getWorkTime();
            customizedEasyuiPagination('pp'); //定制化分页
        },
        gridTableCellStyler: function (value) {
            if (value == 0) { return 'background-color:rgb(236, 128, 141)'; } else { return 'background-color:rgb(149, 242, 2)'; }
        },
        formatDate: function (val) {
            var date = new Date(val);
            if (navigator.userAgent.indexOf("MSIE") > -1) { date = new Date(val.replace(/-/g, '/')); }
            var y = date.getFullYear();
            var m = date.getMonth() + 1;
            var d = date.getDate();
            var h = date.getHours();
            return y + '-' + (m < 10 ? ('0' + m) : m) + '-' + (d < 10 ? ('0' + d) : d);
        },
        //页面事件绑定
        bind: function () {
            //扫描任务单
            $('#Text12,#Text13,#Text14,#Text15,#Text16').textbox({
                inputEvents: $.extend({}, $.fn.textbox.defaults.inputEvents, {
                    keyup: function (event) {
                        if (event.keyCode == 13) {
                            page.getZSWorkReportContainerInfo();
                        }
                    }
                })
            });
            $('#WorkReporTable').datagrid({
                rownumbers: true,
                singleSelect: true,
                columns: [[
          { field: 'MACHINENAME', title: '发动机号', width: 120, align: 'center' },
          { field: 'CONTAINERNO', title: '任务单号', width: 150, align: 'center' },
          { field: 'PRODUCTDESC', title: '件号名称', width: 90, align: 'center' },
          { field: 'WORKFLOWNAMEVER', title: '工艺路线信息', width: 200, align: 'center' },
          { field: 'WFDESC', title: '工艺路线名称', width: 90, align: 'center' },
          { field: 'MACHINESTEPNAME', title: '阶段', width: 100, align: 'center' },
          { field: 'PLANNEDSTARTDATE', title: '计划开始时间', width: 150, align: 'center', formatter: function (value, row, index) { return page.formatDate(value); } },
          { field: 'PLANNEDCOMPLETIONDATE', title: '计划完成时间', width: 150, align: 'center', formatter: function (value, row, index) { return page.formatDate(value); } }
        ]],
                onSelect: function (index, row) {
                    page.getWorkflowStep(row);
                },
                onUnselect: function (index, row) {
                    clearEasyuiDataGrid('wgWorkflowsteps', null);
                    clearEasyuiDataGrid('wgStepInfo', null);
                }
            });
            $("#wgWorkflowsteps").datagrid({
                checkOnSelect: false,
                selectOnCheck: false,
                singleSelect: true,
                columns: [[
          { field: 'PK', checkbox: true, width: 120, align: 'center' },
          { field: 'OPDESC', title: '工序', width: 200, align: 'left' },
          { field: 'SPECNO', title: '工序号', width: 90, align: 'center' },
          { field: 'ISLASTSTEP', title: '是否末序', width: 70, align: 'center' },
          { field: 'ISKEY', title: '是否关键工序', width: 80, align: 'center' },
          { field: 'WORKCENTER', title: '并行工序组', width: 80, align: 'center' },
          { field: 'TEAMNAME', title: '责任班组', width: 80, align: 'center' },
          { field: 'STATUS', title: '任务状态', width: 80, align: 'center' },
          { field: 'PLANNEDSTARTDATE', title: '计划开始时间', width: 80, align: 'center', formatter: function (value, row, index) { return page.formatDate(value); } },
          { field: 'PLANNEDFINISHDATE', title: '计划结束时间', width: 80, align: 'center', formatter: function (value, row, index) { return page.formatDate(value); } },
          { field: 'SENDSTATUS', title: '配送提请状态', width: 80, align: 'center' }
        ]],
                onLoadSuccess: function (data) {
                    if (data.total > 0) {
                        $("#wgWorkflowsteps").datagrid('checkAll');
                        page.getStepInfo();
                    }
                },
                onSelect: function (index, row) {
                    $("#wgWorkflowsteps").datagrid("uncheckAll").datagrid("checkRow", index); //单选行，去掉同时勾选
                },
                onCheck: function (index, row) {
                    var checkRows = $("#wgWorkflowsteps").datagrid("getChecked");
                    var selectRow = $("#wgWorkflowsteps").datagrid("getSelected");
                    if (checkRows.length > 1) {
                        $("#wgWorkflowsteps").datagrid("clearSelections");
                    }
                    page.getStepInfo();
                },
                onUncheck: function (index, row) {
                    page.getStepInfo();
                },
                onCheckAll: function (index, row) {
                    $("#wgWorkflowsteps").datagrid("clearSelections");
                    page.getStepInfo();
                },
                onUncheckAll: function (index, row) {
                    page.getStepInfo();
                }
            });
            $("#wgStepInfo").datagrid({
                columns: [[
          { field: 'PK', checkbox: true, width: 120, align: 'center' },
          { field: 'WORKFLOWSTEPNAME', title: '工序', width: 200, align: 'left' },
          { field: 'STEPINFODESC', title: '工步', width: 200, align: 'left' },
          { field: 'STEPSEQ', title: '工步序号', width: 120, align: 'center' },
          { field: 'SPECTYPENAME', title: '工步类型', width: 90, align: 'center' },
          { field: 'TEAMNAME', title: '班组', width: 80, align: 'center' },
          { field: 'DISPATCHFULLNAME', title: '派工人', width: 80, align: 'center' }
        ]],
                onLoadSuccess: function (data) {
                    if (data.total > 0) {
                        $("#wgStepInfo").datagrid('checkAll');
                    } else {
                        $("#wgStepInfo").datagrid('uncheckAll');
                    }
                }
            });

        },
        //查询
        searchData: function () {
            clearMessage();
            page.getZSWorkReportContainerInfo();
            page.getWorkTime();
            clearEasyuiDataGrid('wgWorkflowsteps', null);
            clearEasyuiDataGrid('wgStepInfo', null);
        },
        //查询重置
        searchReset: function () {
            $('#searchForm').form('clear');
            page.bind();
            clearMessage();
        },
        //获取工时信息
        getWorkTime: function () {
            page.post({ action: "getWorkTime" }, true, function (res) {
                if (res.Result) {
                    $('#txtTimeAttribute').textbox('setValue', res.ReturnData.txtTimeAttribute);
                    $('#txtSumWorkTime').textbox('setValue', res.ReturnData.txtSumWorkTime);
                    $('#txtSumJX').textbox('setValue', res.ReturnData.txtSumJX);
                    var lossReason = res.DBTable;
                    lossReason.push({ LOSSREASONID: '', LOSSREASONNAME: '\u3000' });
                    $('#ddlReasonType').combobox({
                        data: lossReason,
                        valueField: 'LOSSREASONID',
                        textField: 'LOSSREASONNAME',
                        panelHeight: 'auto',
                        value: ''
                    });
                } else { displayMessage(res.Message, false); }
            });
        },
        //查询工人待报工任务单信息
        getZSWorkReportContainerInfo: function () {
            var frdata = $('#searchForm').serializeArray();
            var data = {};
            $.each(frdata, function () {
                data[this.name] = this.value
            });
            var param = {
                action: "getZSWorkReportContainerInfo",
                data: JSON.stringify(data)
            };
            page.post(param, true, function (res) {
                if (res.Result) {
                    $('#WorkReporTable').datagrid('loadData', res.DBTable);
                } else {
                    $('#WorkReporTable').datagrid('loadData', []);
                }
            });
        },
        //查询任务单工序信息
        getWorkflowStep: function (data) {
            var param = {
                action: "getWorkflowStep",
                data: JSON.stringify(data)
            };
            page.post(param, true, function (res) {
                if (res.Result) {
                    $('#wgWorkflowsteps').datagrid('loadData', res.DBTable);
                }
            });
        },
        //查询任务单工序-工步信息
        getStepInfo: function () {
            var mrow = $('#WorkReporTable').datagrid('getSelected');
            var data = $('#wgWorkflowsteps').datagrid('getChecked');
            if (mrow == null) return;
            if (data.length == 0) { clearEasyuiDataGrid('wgStepInfo', null); return; }
            var param = {
                action: "getStepInfo",
                ContainerID: mrow.CONTAINERID,
                data: JSON.stringify(data)
            };
            page.post(param, true, function (res) {
                if (res.Result) {
                    $('#wgStepInfo').datagrid('loadData', res.DBTable);
                } else {
                    $('#wgStepInfo').datagrid('loadData', []);
                }
            });
        },
        //查看准备进度
        lookProgress: function () {
            var mrow = $('#WorkReporTable').datagrid('getSelected');
            var wsrow = $('#wgWorkflowsteps').datagrid('getSelected');
            if (wsrow == null) { displayMessage('请选择一条工序再进行操作', false); return; }
            var obj = {
                width: 1000,
                height: 820,
                href: 'ZSLookProgressPreparation.html?id=' + wsrow.WORKFLOWSTEPID + '&ContainerNo=' + mrow.CONTAINERNO + '&ContainerID=' + mrow.CONTAINERID
            }
            page.post({ action: "lookProgress", data: JSON.stringify(mrow) }, true, function (res) {
                if (res.Result) { page.showModalDialog(obj); }
            });
        },
        //查看工艺
        puplViewDocument: function () {
            var mrow = $('#WorkReporTable').datagrid('getSelected');
            if (mrow == null) { displayMessage('请选择一条请选择任务单记录再进行操作', false); return; }
            var obj = {
                width: 670,
                height: 590,
                href: '../ProcessDocumentViewPopupForm.aspx'
            }
            page.post({ action: "puplViewDocument", data: JSON.stringify(mrow) }, true, function (res) {
                if (res.Result) { page.showModalDialog(obj); }
            });
        },
        //任务接收
        receiveDispatch: function () {
            var mrow = $('#WorkReporTable').datagrid('getSelected');
            var steprows = $('#wgStepInfo').datagrid('getChecked');
            var DispatchIDs = [];
            $.each(steprows, function (index, item) {
                DispatchIDs.push("'" + item.CONTAINERSTEPDISPATCHID + "'");
            });
            if (DispatchIDs.length == 0) { displayMessage('请勾选要接收的派工任务', false); return; }
            page.post({ action: "receiveDispatch", DispatchIDs: DispatchIDs.join(',') }, true, function (res) {
                if (res.Result) { page.getWorkflowStep(mrow); }
                displayMessage(res.Message, res.Result);
            });
        },
        //发送配送提请
        sendDeliveryApply: function () {
            var mrow = $('#WorkReporTable').datagrid('getSelected');
            var wsrow = $('#wgWorkflowsteps').datagrid('getChecked');
            if (wsrow.length == 0) { displayMessage('请勾选至少一条工序再进行操作', false); return; }
            var wids = [];
            $.each(wsrow, function (index, item) {
                wids.push(item.WORKFLOWSTEPID);
            });

            var obj = {
                title: '发送配送提请',
                width: 1000,
                height: 620,
                href: 'ZSSendRequest.html?id=' + wids + '&ContainerNo=' + mrow.CONTAINERNO + '&ContainerID=' + mrow.CONTAINERID + '&mfgorderid=' + mrow.MFGORDERID
            }
            page.showModalDialog(obj);
        },
        //收料确认
        reciveMaterialConfirm: function () {
            var mrow = $('#WorkReporTable').datagrid('getSelected');
            var wsrow = $('#wgWorkflowsteps').datagrid('getSelected');
            if (wsrow == null) { displayMessage('请选择一条工序再进行操作', false); return; }
            var obj = {
                width: 1000,
                height: 820,
                href: 'ZSKGReciveMaterialConfirm.html?id=' + wsrow.WORKFLOWSTEPID + '&ContainerNo=' + mrow.CONTAINERNO + '&ContainerID=' + mrow.CONTAINERID
            }
            page.post({ action: "reciveMaterialConfirm", data: JSON.stringify(mrow) }, true, function (res) {
                if (res.Result) { page.showModalDialog(obj); }
            });
        },
        //任务单工序开工
        containerWorkflowstepOpenWork: function () {
            var mrow = $('#WorkReporTable').datagrid('getSelected');
            var wsrow = $('#wgWorkflowsteps').datagrid('getChecked');
            //if (wsrow.length == 0) { displayMessage('请勾择至少一条工序再进行操作', false); return; }
            var data = { ContainerID: mrow.CONTAINERID, ContainerNo: mrow.CONTAINERNO }; //workflowstepID: workflowstepID.join(',')workflowstepid: wsrow.WORKFLOWSTEPID
            page.post({ action: "containerWorkflowstepOpenWork", data: JSON.stringify(data), dt: JSON.stringify(wsrow) }, true, function (res) {
                if (res.Result) { page.getWorkflowStep(mrow); }
                displayMessage(res.Message, res.Result);
            });
        },
        //装配操作
        puplIssueOperate: function () {
            var mrow = $('#WorkReporTable').datagrid('getSelected');
            var wsrows = $('#wgWorkflowsteps').datagrid('getChecked');
            var steprows = $('#wgStepInfo').datagrid('getRows');
            if (mrow == null) { displayMessage('请选择一条任务单', false); return; }
            var str = "";
            $.each(wsrows, function (index, item) {
                if (item.STATUS != "装配中") {
                    str += item.STATUS;
                }
            });
            if (str != "") { displayMessage('所选择的工序记录含有非【装配中】的记录，不能进行装配', false); return; }
            var steprowsID = [];
            $.each(steprows, function (index, item) {
                if (item.STEPINFOID != null && item.STEPINFOID!='') {
                    steprowsID.push("'" + item.STEPINFOID + "'");
                }
            });
            var obj = {
                width: 930,
                height: 620,
                href: 'ContainerIssueRecordPopuForm.aspx'
            }
            var data = { ContainerID: mrow.CONTAINERID, WorkflowID: mrow.WORKFLOWID  };
            if (steprowsID.length > 0) {
                data.StepInfoIDs=steprowsID.join(',')
            }
            page.post({ action: "puplIssueOperate", data: JSON.stringify(data) }, true, function (res) {
                if (res.Result) { page.showModalDialog(obj); }
            });
        },
        //分解操作
        pupSplitOperate: function () {
            var mrow = $('#WorkReporTable').datagrid('getSelected');
            if (mrow == null) { displayMessage('请选择一条任务单', false); return; }
            var obj = {
                width: 930,
                height: 620,
                href: 'ContainerSplitRecordPopuForm.aspx'
            }
            var data = { ContainerID: mrow.CONTAINERID, WorkflowID: mrow.WORKFLOWID, StepInfoIDs: "" };
            page.post({ action: "puplIssueOperate", data: JSON.stringify(data) }, true, function (res) {
                if (res.Result) { page.showModalDialog(obj); }
            });
        },
        //实测值录入
        pupInputChechPoint: function () {
            var mrow = $('#WorkReporTable').datagrid('getSelected');
            var wsrows = $('#wgWorkflowsteps').datagrid('getChecked');
            var steprows = $('#wgStepInfo').datagrid('getChecked');
            if (mrow == null) { displayMessage('请选择一条任务单', false); return; }
            if (steprows == null) { displayMessage('没有选择工步资料', false); return; }
            var str = "";
            $.each(wsrows, function (index, item) {
                if (item.STATUS != "装配中") {
                    str += item.STATUS;
                }
            });
            if (str != "") { displayMessage('所选择的工序记录含有非【装配中】的记录，不能进行实测值录入', false); return; }
            var obj = {
                width: 1000,
                height: 760,
                href: 'InputStepCheckPointResultZSPopupForm.aspx'
            }
            var data = { ContainerID: mrow.CONTAINERID, ContainerName: mrow.CONTAINERNAME, Machine: mrow.MACHINENAME };
            page.post({ action: "pupInputChechPoint", data: JSON.stringify(steprows), mdata: JSON.stringify(data) }, true, function (res) {
                if (res.Result) { page.showModalDialog(obj); }
            });
        },
        //质量问题查看
        pupQualityCheck: function () {
            var mrow = $('#WorkReporTable').datagrid('getSelected');
            if (mrow == null) { displayMessage('请选择一条任务单', false); return; }
            var obj = {
                width: 930,
                height: 600,
                href: 'QualityHistoryRecordPopuForm.aspx'
            }
            var productname = mrow.MACHINENAME; //MachineName
            //if (mrow.PRODUCTNAME.Indexof(':')>=0) { productname = mrow.PRODUCTNAME; }
            var data = { productname: productname };
            page.post({ action: "pupQualityCheckOrPartRecept", data: JSON.stringify(data) }, true, function (res) {
                if (res.Result) { page.showModalDialog(obj); }
            });
        },
        //零组件交接
        PupPartRecept: function () {
            var mrow = $('#WorkReporTable').datagrid('getSelected');
            if (mrow == null) { displayMessage('请选择一条任务单', false); return; }
            var obj = {
                width: 1300,
                height: 600,
                href: 'PartReceptPopupForm.aspx'
            }
            var data = { BomId: mrow.BOMID, ContainerId: mrow.CONTAINERID, ContainerNo: mrow.CONTAINERNO, MfgorderName: mrow.MFGORDERNAME, MfgorderId: mrow.MFGORDERID };
            page.post({ action: "pupQualityCheckOrPartRecept", data: JSON.stringify(data) }, true, function (res) {
                if (res.Result) { page.showModalDialog(obj); }
            });
        },
        showModalDialog: function (obj) {
            var someValue = window.showModalDialog(obj.href, "", "dialogWidth:" + obj.width + "px; dialogHeight:" + obj.height + "px; status=no; center: Yes; resizable: NO;");
            if (obj.title != undefined && obj.title == "发送配送提请") {
                var mrow = $('#WorkReporTable').datagrid('getSelected');
                page.getWorkflowStep(mrow);
            }
        },
        //工人报工操作
        addContainerStepWorkReportInfo: function () {
            var mrow = $('#WorkReporTable').datagrid('getSelected');
            var wsrows = $('#wgWorkflowsteps').datagrid('getChecked');
            var wsAllrows = $('#wgWorkflowsteps').datagrid('getRows');
            var steprows = $('#wgStepInfo').datagrid('getChecked');
            if (mrow == null) { displayMessage('请选择报工任务单', false); return; }
            if (steprows.length == 0) { displayMessage('请选择要报工的工序工步记录', false); return; }
            var str = "";
            var workflowstep = [];
            $.each(wsrows, function (index, item) {
                if (item.STATUS != "装配中") {
                    str += item.STATUS;
                    workflowstep.push(item.WORKFLOWSTEPNAME);
                }
            });
            if (str != "") { displayMessage('报工工步对应工序【' + workflowstep.join(',') + '】未开工，不能进行报工', false); return; }
            mrow.ddlReasonType = $('#ddlReasonType').combobox('getValue');
            mrow.txtReason = $('#txtReason').textbox('getValue');
            page.post({ action: "addContainerStepWorkReportInfo", data: JSON.stringify(mrow), wgStepInfo: JSON.stringify(steprows) }, true, function (res) {
                if (res.Result) {
                    if (wsAllrows.length == wsrows.length) {
                        $('#wgStepInfo').datagrid('loadData', []);
                        $('#wgWorkflowsteps').datagrid('loadData', []);
                        page.getZSWorkReportContainerInfo();
                    } else {
                        page.getWorkflowStep(mrow);
                    }
                    $('#ddlReasonType').combobox('setValue', '');
                    $('#txtReason').textbox('setValue', '');
                }
                displayMessage(res.Message, res.Result);
            });
        },
        //保存日结工序问题记录
        saveDailySettlementSpecProblemRecord: function () {
            var mrow = $('#WorkReporTable').datagrid('getSelected');
            var wsrows = $('#wgWorkflowsteps').datagrid('getChecked');
            var steprows = $('#wgStepInfo').datagrid('getChecked');
            if (wsrows.length == 0) { displayMessage('请勾选至少一条工序，再进行操作'); return; }
            var wgWorkflowsteps = [];
            var stepids = [];
            $.each(wsrows, function (index, item) { wgWorkflowsteps.push(item.WORKFLOWSTEPID); });
            $.each(steprows, function (index, item) { if (item.STEPINFOID != null) { stepids.push(item.STEPINFOID); } });
            var data = { ContainerID: mrow.CONTAINERID, WorkFlowStepID: wgWorkflowsteps.join(','), StepInfoID: stepids.join(','), Record: $('#DailySettlementSpecProblemRecord').textbox('getValue') };
            if (data.Record == "") { displayMessage('请输入日结工序问题，再进行操作'); return; }
            page.post({ action: "saveDailySettlementSpecProblemRecord", data: JSON.stringify(data) }, true,
        function (res) {
            displayMessage(res.Message, res.Result);
            $('#DailySettlementSpecProblemRecord').textbox('setValue', '');
        });
        },
        //清除方法，重要！！！
        reset: function (iscondition, isresult) {
            clearMessage();
        },
        //post数据
        post: function (param, async, callback) {
            clearMessage();
            $.ajax({
                type: "Post",
                url: page.ajaxUrl,
                data: param,
                cashe: false,
                async: async,
                dataType: "json",
                beforeSend: function () {
                    $.messager.progress({ text: '', msg: '处理中...' });
                },
                success: function (data) {
                    $.messager.progress('close');
                    callback(data);
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    $.messager.progress('close');
                    displayMessage(XMLHttpRequest.responseText, false);
                }
            });
        },
        //跳转问题快反
        createMesFeedBack: function () {
            var mrow = $('#WorkReporTable').datagrid('getSelected');
            //获取当前登录用户名
            var employeename = window.top.location.search.split('?')[1].match(/(^|&)EmployeeName=([^&]*)(&|$)/)[2];
            if (mrow) {
                var data = { createuser: 'MES_' + employeename, containerid: mrow.CONTAINERID };
                page.post({ action: "saveBpmContainerInfo", data: JSON.stringify(data) }, true, function (res) {
                    if (res.Result) {
                        window.open('http://10.15.7.194:8088/portal/ssologin_mes_feedback_new.jsp?iv-user=' + employeename);
                    }
                });
            } else {
                window.open('http://10.15.7.194:8088/portal/ssologin_mes_feedback_new.jsp?iv-user=' + employeename);
            }
        }
    }
  $(function () {
    page.init();
  });



</script>